home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / programming / other / cyberxxxsrc / decoder / txt / decodeyv12.c < prev    next >
C/C++ Source or Header  |  1999-02-08  |  1KB  |  58 lines

  1. /*
  2. sc:c/sc opt txt/DecodeYV12.c
  3. */
  4.  
  5. #include "Decode.h"
  6. #include "YUV.h"
  7. #include "GlobalVars.h"
  8. #include "Utils.h"
  9.  
  10. struct YV12Data {
  11.   ulong dummy;
  12. };
  13.  
  14. extern void __regargs YUV221111toRGB(uchar *image, ulong width, ulong height, ulong ix, ulong iy);
  15. extern void __regargs YUV221111to332(uchar *image, ulong width, ulong height, ulong ix, ulong iy);
  16. extern void __regargs YUV221111to332Dith(uchar *image, ulong width, ulong height, ulong ix, ulong iy);
  17.  
  18. void __regargs (*yv12yuv221111) (uchar *image, ulong width, ulong height, ulong ix, ulong iy);
  19.  
  20. /* /// "SelectYV12Funcs()" */
  21. __asm void SelectYV12Funcs(REG(a0) struct YV12Data *spec,
  22.                            REG(d0) uchar _gray,
  23.                            REG(d1) uchar _dither)
  24. {
  25.   if (_gray) {
  26.     yv12yuv221111=YUV221111to332;
  27.   } else if (_dither) {
  28.     yv12yuv221111=YUV221111to332Dith;
  29.   } else {
  30.     yv12yuv221111=YUV221111toRGB;
  31.   }
  32. }
  33. /* \\\ */
  34.  
  35. /* /// "DecodeYV12()" */
  36. __asm void DecodeYV12(REG(a0) uchar *from,
  37.                       REG(a1) uchar *to,
  38.                       REG(d0) ulong width,
  39.                       REG(d1) ulong height,
  40.                       REG(d2) ulong encSize,
  41.                       REG(a2) struct YV12Data *spec)
  42. {
  43.   ulong size=width*height;
  44.   struct YUVBuffer buf;
  45.  
  46.   if (gray)
  47.     mycopymem((ulong *)from,(ulong *)to,size);
  48.   else {
  49.     yuvBuf=&buf;
  50.     buf.yBuf=from;
  51.     buf.uBuf=from+size+(size>>2);
  52.     buf.vBuf=from+size;
  53.     yv12yuv221111(to,width,height,width,height);
  54.   }
  55. }
  56. /* \\\ */
  57.  
  58.